﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace Cienco610.Models.DAL
{
    public class AdvertDAL
    {
        private DBCiencoDataContext SC_DB;
        public AdvertDAL()
        {
            SC_DB = new DBCiencoDataContext();
        }
        public List<Advert> getListAdvert()
        {
            return SC_DB.Adverts.ToList();
        }
        public int createAdvert(Advert adv)
        {
            int result = 0;
            try
            {
                SC_DB.Adverts.InsertOnSubmit(adv);
                SC_DB.SubmitChanges();
                result = 1;
            }
            catch
            {
            }
            return result;
        }
    }
}